package com.kk.my_pro.common.result;


import lombok.Getter;
import lombok.ToString;
import org.springframework.http.HttpStatus;

/**
 * @author wxj
 */

@ToString
@Getter
public enum ApiResultStatus {
    /**
     * 请求成功
     */
    SUCCESS(HttpStatus.OK, 200, "OK"),
    /**
     * 处理异常
     */
    BAD_REQUEST(HttpStatus.BAD_REQUEST, 400, "Bad Request"),
    /**
     * 没有权限
     */
    UNAUTHORIZED(HttpStatus.UNAUTHORIZED, 401, "Unauthorized"),
    /**
     * 没有权限
     */
    FORBIDDEN(HttpStatus.FORBIDDEN, 403, "Forbidden"),
    /**
     * 服务器错误
     */
    INTERNAL_SERVER_ERROR(HttpStatus.INTERNAL_SERVER_ERROR, 500, "Internal Server Error"),
    /**
     * 资源不存在
     */
    NOT_FOUND(HttpStatus.NOT_FOUND, 404, "Not Found"),
    /**
     * 需要更新数据
     */
    UPGRADE_REQUIRED(HttpStatus.UPGRADE_REQUIRED, 426, "Upgrade Required"),
    ;

    /**
     * 返回的HTTP状态码,  符合http请求
     */
    private final HttpStatus httpStatus;
    /**
     * 业务异常码
     */
    private final Integer code;
    /**
     * 业务异常信息描述
     */
    private final String message;

    ApiResultStatus(HttpStatus httpStatus, Integer code, String message) {
        this.httpStatus = httpStatus;
        this.code = code;
        this.message = message;
    }
}